<?php
/**
 *
 * PostAction.class.php (前台内容管理)
 *
 * @package      	jgsat
 * @author          liuxun QQ:147613338 <web@jgsat.cn>
 * @copyright     	Copyright (c) 2008-2011  (http://www.jgsat.com)
 * @license         http://www.jgsat.com/license.txt
 * @version        	jgsat企业网站管理系统 v2.1 2011-03-01 jgsat.cn $
 */
if(!defined("JGsat")) exit("Access Denied");
class PostAction extends BaseAction
{
    protected  $dao,$fields;
    public function _initialize()
    {
        parent::_initialize();		 
    }

    /**
     * 录入
     *
     */
    public function insert()
    {
        $module=$_REQUEST["modulename"];
        $db=M($module);
        $_POST['ip'] = get_client_ip();
        if(!$db->create($_POST)) {
            $this->error($db->getError());
        }
        $db->createtime = time();
        $db->lang = LANG_ID;
        $result	=$db->add();
        
        if($result) {
            $this->success('提交成功！');
        }else{
            $this->error('提交失败，请稍后再试！');
        }
    }

    public function adds()
    {
    $massges=$_REQUEST["Guestbook"];
        $db=M('Guestbook');
        $verifyCode =$_POST['verifyCode'];
        if(md5($verifyCode) != $_SESSION['verify']){
            $this->error(L('error_verify'));
        }
    
        if(!$db->create($_POST)) {
            $this->error($db->getError());
        }
        $db->createtime = time();
        $db->lang = 1;
        $result =$db->add();
      
        
        if($result) {
            $this->success("提交成功");
        }else{
            $this->error("提交失败");
        }

    }

}?>